<?php

namespace Home\Controller;


class ShoppingController extends HomeCommonController
{
    /**
     * 接口示例
     *
     * http://127.0.0.1:8093/index.php?s=/Shopping/index
     */
    public function index()
    {
        //echo "success";
        //var_dump(generalMatchCode(11));
        //$this->jsApiCall();
    }
     /**
     * 商品列表
     *
     */
    public function goodsList()
    {
    	$model = M('goods');
    	$goods = M('goods')->where(array('del_flg' => 0))->select();
    	if ($goods) {
            $this->showMessage($goods);
        }else{
            $code = self::ERROR_CODE;
            $message = self::DATA_EMPTY;
            $this->showMessage(array(), $code, $message);
        } 
    }
     /**
     * 商品详细
     *
     */
     public function goodsDetail()
     {
     	$goods_id = ''? NULL:I('id');	
		if (empty($goods_id)) {
            $code = self::ERROR_CODE;
            $message = self::PARAM_ERROR;
            $this->showMessage(array(), $code, $message);  
        }
        $model = M('goods');
    	$goods = M('goods')->getById($goods_id);
    	if ($goods) {
            $this->showMessage($goods);
        }else{
            $code = self::ERROR_CODE;
            $message = self::DATA_EMPTY;
            $this->showMessage(array(), $code, $message);
        } 
     }
} 